.class public Lcom/inmobi/androidsdk/bootstrapper/Initializer;
.super Ljava/lang/Object;
.source "Initializer.java"


# static fields
.field public static final PRODUCT_ADNETWORK:Ljava/lang/String; = "adNetwork"

.field private static a:Landroid/content/Context;

.field private static b:Lorg/json/JSONObject;

.field private static c:Ljava/util/Map;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation
.end field

.field private static d:Lcom/inmobi/androidsdk/bootstrapper/ConfigParams;

.field private static e:Lcom/inmobi/commons/cache/CacheController$Validator;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    const/4 v0, 0x0

    .line 22
    sput-object v0, Lcom/inmobi/androidsdk/bootstrapper/Initializer;->a:Landroid/content/Context;

    .line 23
    sput-object v0, Lcom/inmobi/androidsdk/bootstrapper/Initializer;->b:Lorg/json/JSONObject;

    .line 24
    new-instance v0, Ljava/util/HashMap;

    invoke-direct {v0}, Ljava/util/HashMap;-><init>()V

    sput-object v0, Lcom/inmobi/androidsdk/bootstrapper/Initializer;->c:Ljava/util/Map;

    .line 26
    new-instance v0, Lcom/inmobi/androidsdk/bootstrapper/ConfigParams;

    invoke-direct {v0}, Lcom/inmobi/androidsdk/bootstrapper/ConfigParams;-><init>()V

    sput-object v0, Lcom/inmobi/androidsdk/bootstrapper/Initializer;->d:Lcom/inmobi/androidsdk/bootstrapper/ConfigParams;

    .line 28
    new-instance v0, Lcom/inmobi/androidsdk/bootstrapper/a;

    invoke-direct {v0}, Lcom/inmobi/androidsdk/bootstrapper/a;-><init>()V

    sput-object v0, Lcom/inmobi/androidsdk/bootstrapper/Initializer;->e:Lcom/inmobi/commons/cache/CacheController$Validator;

    return-void
.end method

.method public constructor <init>()V
    .locals 0

    .prologue
    .line 19
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method static synthetic a(Ljava/lang/String;)Ljava/lang/String;
    .locals 1
    .parameter

    .prologue
    .line 19
    invoke-static {p0}, Lcom/inmobi/androidsdk/bootstrapper/Initializer;->b(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method private static a(Landroid/content/Context;)V
    .locals 3
    .parameter

    .prologue
    .line 41
    if-eqz p0, :cond_2

    sget-object v0, Lcom/inmobi/androidsdk/bootstrapper/Initializer;->a:Landroid/content/Context;

    if-nez v0, :cond_2

    .line 42
    sget-object v0, Lcom/inmobi/androidsdk/bootstrapper/Initializer;->a:Landroid/content/Context;

    if-eqz v0, :cond_1

    .line 54
    :cond_0
    :goto_0
    return-void

    .line 44
    :cond_1
    invoke-virtual {p0}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;

    move-result-object v0

    sput-object v0, Lcom/inmobi/androidsdk/bootstrapper/Initializer;->a:Landroid/content/Context;

    .line 45
    invoke-static {p0}, Lcom/inmobi/androidsdk/bootstrapper/Initializer;->getUidMap(Landroid/content/Context;)Ljava/util/Map;

    move-result-object v0

    sput-object v0, Lcom/inmobi/androidsdk/bootstrapper/Initializer;->c:Ljava/util/Map;

    .line 48
    :try_start_0
    const-string v0, "adNetwork"

    sget-object v1, Lcom/inmobi/androidsdk/bootstrapper/Initializer;->c:Ljava/util/Map;

    sget-object v2, Lcom/inmobi/androidsdk/bootstrapper/Initializer;->e:Lcom/inmobi/commons/cache/CacheController$Validator;

    invoke-static {v0, p0, v1, v2}, Lcom/inmobi/commons/cache/CacheController;->getConfig(Ljava/lang/String;Landroid/content/Context;Ljava/util/Map;Lcom/inmobi/commons/cache/CacheController$Validator;)Lcom/inmobi/commons/cache/ProductConfig;

    move-result-object v0

    invoke-virtual {v0}, Lcom/inmobi/commons/cache/ProductConfig;->getData()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Lcom/inmobi/androidsdk/bootstrapper/Initializer;->b(Ljava/lang/String;)Ljava/lang/String;
    :try_end_0
    .catch Lcom/inmobi/commons/internal/CommonsException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 49
    :catch_0
    move-exception v0

    goto :goto_0

    .line 52
    :cond_2
    sget-object v0, Lcom/inmobi/androidsdk/bootstrapper/Initializer;->a:Landroid/content/Context;

    if-nez v0, :cond_0

    if-nez p0, :cond_0

    .line 53
    new-instance v0, Ljava/lang/NullPointerException;

    invoke-direct {v0}, Ljava/lang/NullPointerException;-><init>()V

    throw v0
.end method

.method private static b(Ljava/lang/String;)Ljava/lang/String;
    .locals 4
    .parameter

    .prologue
    .line 71
    sget-object v0, Lcom/inmobi/androidsdk/bootstrapper/Initializer;->a:Landroid/content/Context;

    invoke-static {v0}, Lcom/inmobi/androidsdk/bootstrapper/Initializer;->getUidMap(Landroid/content/Context;)Ljava/util/Map;

    move-result-object v0

    sput-object v0, Lcom/inmobi/androidsdk/bootstrapper/Initializer;->c:Ljava/util/Map;

    .line 73
    :try_start_0
    new-instance v2, Lorg/json/JSONObject;

    invoke-direct {v2, p0}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_2

    .line 76
    :try_start_1
    const-string v0, "common"

    invoke-virtual {v2, v0}, Lorg/json/JSONObject;->getJSONObject(Ljava/lang/String;)Lorg/json/JSONObject;
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0

    move-result-object v0

    move-object v1, v0

    .line 82
    :goto_0
    :try_start_2
    const-string v0, "AND"

    invoke-virtual {v2, v0}, Lorg/json/JSONObject;->getJSONObject(Ljava/lang/String;)Lorg/json/JSONObject;
    :try_end_2
    .catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_1

    move-result-object v0

    .line 87
    :goto_1
    const/4 v3, 0x1

    :try_start_3
    invoke-static {v0, v1, v3}, Lcom/inmobi/commons/internal/InternalSDKUtil;->populateToNewJSON(Lorg/json/JSONObject;Lorg/json/JSONObject;Z)Lorg/json/JSONObject;

    move-result-object v0

    sput-object v0, Lcom/inmobi/androidsdk/bootstrapper/Initializer;->b:Lorg/json/JSONObject;

    .line 88
    sget-object v0, Lcom/inmobi/androidsdk/bootstrapper/Initializer;->d:Lcom/inmobi/androidsdk/bootstrapper/ConfigParams;

    sget-object v1, Lcom/inmobi/androidsdk/bootstrapper/Initializer;->b:Lorg/json/JSONObject;

    invoke-virtual {v0, v1}, Lcom/inmobi/androidsdk/bootstrapper/ConfigParams;->setFromJSON(Lorg/json/JSONObject;)V
    :try_end_3
    .catch Ljava/lang/Exception; {:try_start_3 .. :try_end_3} :catch_2

    .line 90
    :try_start_4
    const-string v0, "AND"

    sget-object v1, Lcom/inmobi/androidsdk/bootstrapper/Initializer;->d:Lcom/inmobi/androidsdk/bootstrapper/ConfigParams;

    invoke-virtual {v1}, Lcom/inmobi/androidsdk/bootstrapper/ConfigParams;->toJSON()Lorg/json/JSONObject;

    move-result-object v1

    invoke-virtual {v2, v0, v1}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 91
    invoke-virtual {v2}, Lorg/json/JSONObject;->toString()Ljava/lang/String;
    :try_end_4
    .catch Lorg/json/JSONException; {:try_start_4 .. :try_end_4} :catch_3
    .catch Ljava/lang/Exception; {:try_start_4 .. :try_end_4} :catch_2

    move-result-object v0

    .line 97
    :goto_2
    return-object v0

    .line 77
    :catch_0
    move-exception v0

    .line 78
    :try_start_5
    new-instance v0, Lorg/json/JSONObject;

    invoke-direct {v0}, Lorg/json/JSONObject;-><init>()V

    move-object v1, v0

    goto :goto_0

    .line 83
    :catch_1
    move-exception v0

    .line 84
    new-instance v0, Lorg/json/JSONObject;

    invoke-direct {v0}, Lorg/json/JSONObject;-><init>()V
    :try_end_5
    .catch Ljava/lang/Exception; {:try_start_5 .. :try_end_5} :catch_2

    goto :goto_1

    .line 94
    :catch_2
    move-exception v0

    .line 95
    const-string v1, "InMobiAndroidSDK_3.7.0"

    const-string v2, "Config couldn\'t be parsed"

    invoke-static {v1, v2, v0}, Lcom/inmobi/commons/internal/Log;->debug(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V

    .line 97
    :goto_3
    const/4 v0, 0x0

    goto :goto_2

    .line 92
    :catch_3
    move-exception v0

    goto :goto_3
.end method

.method private static b(Landroid/content/Context;)V
    .locals 3
    .parameter

    .prologue
    .line 57
    invoke-static {p0}, Lcom/inmobi/androidsdk/bootstrapper/Initializer;->a(Landroid/content/Context;)V

    .line 60
    :try_start_0
    const-string v0, "adNetwork"

    sget-object v1, Lcom/inmobi/androidsdk/bootstrapper/Initializer;->c:Ljava/util/Map;

    sget-object v2, Lcom/inmobi/androidsdk/bootstrapper/Initializer;->e:Lcom/inmobi/commons/cache/CacheController$Validator;

    invoke-static {v0, p0, v1, v2}, Lcom/inmobi/commons/cache/CacheController;->getConfig(Ljava/lang/String;Landroid/content/Context;Ljava/util/Map;Lcom/inmobi/commons/cache/CacheController$Validator;)Lcom/inmobi/commons/cache/ProductConfig;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 64
    :goto_0
    return-void

    .line 61
    :catch_0
    move-exception v0

    goto :goto_0
.end method

.method public static getConfigParams(Landroid/content/Context;)Lcom/inmobi/androidsdk/bootstrapper/ConfigParams;
    .locals 1
    .parameter

    .prologue
    .line 36
    invoke-static {p0}, Lcom/inmobi/androidsdk/bootstrapper/Initializer;->b(Landroid/content/Context;)V

    .line 37
    sget-object v0, Lcom/inmobi/androidsdk/bootstrapper/Initializer;->d:Lcom/inmobi/androidsdk/bootstrapper/ConfigParams;

    return-object v0
.end method

.method public static getUidMap(Landroid/content/Context;)Ljava/util/Map;
    .locals 2
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/content/Context;",
            ")",
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation

    .prologue
    .line 67
    sget-object v0, Lcom/inmobi/androidsdk/bootstrapper/Initializer;->a:Landroid/content/Context;

    sget-object v1, Lcom/inmobi/androidsdk/bootstrapper/Initializer;->d:Lcom/inmobi/androidsdk/bootstrapper/ConfigParams;

    invoke-virtual {v1}, Lcom/inmobi/androidsdk/bootstrapper/ConfigParams;->getUID()Lcom/inmobi/commons/uid/UID;

    move-result-object v1

    invoke-static {v0, v1}, Lcom/inmobi/commons/uid/UIDUtil;->getMap(Landroid/content/Context;Lcom/inmobi/commons/uid/UID;)Ljava/util/Map;

    move-result-object v0

    return-object v0
.end method
